﻿using Castle.Core;
using Castle.MicroKernel.Handlers;
using System;

namespace Inovout.Components
{
    public class DelegateServiceStrategy : IGenericServiceStrategy
    {
        private readonly Func<Type, ComponentModel, bool> supports;

        public DelegateServiceStrategy(Func<Type, ComponentModel, bool> supports)
        {
            this.supports = supports;
        }

        public bool Supports(Type service, ComponentModel component)
        {
            return supports.Invoke(service, component);
        }
    }
}
